<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$return=array();
if($_RQ['op']=='get'){
	$return['item']=core_setting('pay');
	$account_tp=SITEROOT.'manage/';
	$account_url=SITEROOT.'manage/payresult/wechat.php';
	$htmls=array(
		'type'=>'edit',
		'post'=>'post',
		'desc'=>'支付',
		'tabs'=>array(
			'0'=>array('op'=>'get','title'=>'系统支付设置设置'),
		),
		'edit'=>array(
			array('type'=>'switch','title'=>'支付宝支付','name'=>'alipay'),
			array('type'=>'string','title'=>'支付宝账号','name'=>'alipay_seller_email','show'=>array('alipay',1), 'help'=>'填写支付宝账号' ),
			array('type'=>'string','title'=>'支付宝合作者身份','name'=>'alipay_partner','show'=>array('alipay',1),'help'=>'填写支付宝合作身份者id，以2088开头的16位纯数字。<br> 
* 提示：如何获取安全校验码和合作身份者id<br> * 1.用您的签约支付宝账号登录支付宝(www.alipay.com)<br> * 2.点击“商家服务”(https://b.alipay.com/order/myorder.htm)<br>* 3.点击“查询合作者身份(pid)”、“查询安全校验码(key)”' ),
			array('type'=>'string','title'=>'支付宝校验密钥','name'=>'alipay_key','show'=>array('alipay',1),'help'=>'填写支付宝安全校验码。以数字和字母组成的32位字符' ),
			array('type'=>'switch','title'=>'微信支付','name'=>'wechat'),
			array('type'=>'tip','title'=>'【<red>温馨提示</red>】：一定要在微信支付商户后台配送好微信支付的回调域名，否则不能正常支付回调，特别是支付授权目录，一定加上，否则会报错“支付失败”！<br>1,JSAPI支付授权目录：'.$account_tp.'<br> 2,扫码回调链接：'.$account_url),
			array('type'=>'string','title'=>'公众号appid','name'=>'appid','show'=>array('wechat'=>1), 'help'=>'' ),
			array('type'=>'string','title'=>'微信支付商户号','name'=>'mch_id','show'=>array('wechat'=>1), 'help'=>'' ),
			array('type'=>'string','title'=>'商户支付密钥','name'=>'api_key','show'=>array('wechat'=>1), 'help'=>'' ),
			array('type'=>'switch','title'=>'余额支付','name'=>'credit'),
		)
	);
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='post'){
	$postdata=get_postdata();
	$setting=array('key'=>'pay','value'=>ijson_encode($postdata));
	pdo_insert('core_settings',$setting,true);
	exi('系统支付设置成功！');
}